<script setup lang="ts">
// 接口
// 主要声明一个具体结构的类型
interface Person {
  birthday?: Date;
  eat?: (food: string) => void;
}

interface Student extends Person {
  id: number;
  name: string;
  age: number;
  car?: string;
  sayHello?: (username: string) => string;
}

let stu1: Student = {
  id: 1,
  name: "张三",
  age: 20,
  car: "奔驰",
};
let stu2: Student = {
  id: 2,
  name: "李四",
  age: 18,
};
let stu3: Student = {
  id: 3,
  name: "王五",
  age: 25,
  car: "宝马",
  sayHello: (username) => {
    return "你好" + username;
  },
};
let stu4: Student = {
  id: 3,
  name: "王五",
  age: 25,
  car: "宝马",
  sayHello: () => {
    return "你好";
  },
};
let stu5: Student = {
  birthday: new Date(),
  eat: (food) => {
    console.log("正在吃" + food);
  },
  id: 3,
  name: "王五",
  age: 25,
  car: "宝马",
};
console.log(stu1)
console.log(stu2)
console.log(stu3)
console.log(stu4)
console.log(stu5)


</script>

<template>

</template>

<style scoped>

</style>